package demo;


import java.util.Random;
import java.util.Scanner;

public class GuessNum{
    public static void main(String[] args) {
        Random random = new Random();
        Scanner scanner = new Scanner(System.in);
        int number = random.nextInt(100);
        while (true) {
            System.out.println("请输入要输入的数字：（0-100）");
            int yourGuess = scanner.nextInt();
            if(yourGuess <number){
                System.out.println("猜小了");
            }else if(yourGuess > number){
                System.out.println("猜大了");
            }else{
                System.out.println("猜对了,游戏结束！");
                break;
            }
        }
        scanner.close();
    }
}
